package com.shop.service.impl;

import com.shop.bean.Goodstable;
import com.shop.bean.GoodstableExample;
import com.shop.mapper.GoodstableMapper;
import com.shop.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    GoodstableMapper goodsMapper;
    @Override
    public int upLoadGood(Goodstable good) {
        return goodsMapper.insert(good);
    }

    @Override
    public List<Goodstable> queryAllGoods() {
        return goodsMapper.selectByExample(new GoodstableExample());
    }
    @Override
    public List<Goodstable> queryPage(Integer begin){
        GoodstableExample goodstableExample = new GoodstableExample();
        goodstableExample.createCriteria().andIdBetween(begin,begin+11);
        return goodsMapper.selectByExample(goodstableExample);
    }
    @Override
    public int queryAllGoodsNum(){
        return goodsMapper.countByExample(new GoodstableExample());
    }
}
